package com.bocai.freeman.view.activitys;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.view.MenuItem;
import android.view.View;

import com.bocai.freeman.R;
import com.bocai.freeman.base.BaseActivity;
import com.bocai.freeman.utils.ToolbarHelper;

/**
 * Created by win7 on 2016/5/25.
 */
public class PersonDataActivity extends BaseActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_person_data);

        initView();
    }

    @Override
    protected void initView() {
        Intent intent = getIntent();
        String type = intent.getStringExtra("type");
        if (!TextUtils.isEmpty(type) && type.equals("editGone")) {
            ToolbarHelper.setup(this, getString(R.string.str_person_msg), R.mipmap.left_return, new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    onBackPressed();
                }
            });
        } else {
            ToolbarHelper.setup(this, getString(R.string.str_person_msg), R.mipmap.left_return, R.menu.menu_edit, new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    onBackPressed();
                }
            }, new Toolbar.OnMenuItemClickListener() {
                @Override
                public boolean onMenuItemClick(MenuItem item) {
                    startActivity(new Intent(PersonDataActivity.this, PersonDataEditActivity.class));
                    return false;
                }
            });
        }
    }
}
